const BASE_URL='http://v.juhe.cn';
function request({url,data,method}){
	return new Promise((resolve,reject)=>{
		uni.request({
			url:BASE_URL+url,
			data,
			method,
			success:({data,statusCode,header})=>{
				if(data.error_code==0){
					resolve(data);
				}else{
					uni.showToast({
						title:data.reason,
						icon:'none',
						mask:true,
						duration:3000
					});
					reject(data.message);
				}
			},
			fail:(error)=>{
				reject(error);
			}
		});
	});
}
export default request;